<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<html>
<head>
		<script src="${contextPath}/scripts/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
	<script src="${contextPath}/scripts/common.js" type="text/javascript"></script>
	<script src="${contextPath}/scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
	<link href="${contextPath}/styles/default.css" rel="stylesheet" type="text/css" />
<title>发票开立管理</title>
<script type="text/javascript">
	function jumpPage(page) {
		var searchForm = document.searchForm;
		searchForm.action = "<s:property value='contextPath'/>/mf/core/index.do?currentPage=" + page;
		searchForm.submit();
	}
	function openBill(id){
		var searchForm = document.searchForm;
		searchForm.action = "addLoke.do?currentPage=${currentPage}&billId="+id;
		searchForm.submit();
	}
	function openSubmint(id){
		var searchForm = document.searchForm;
		searchForm.action = "billSubmit.do?currentPage=${currentPage}&id="+id;
		searchForm.submit();
	}
	function billEdit(id) {
		var form1 = document.searchForm;
		form1.action = "<s:property value='contextPath'/>/mf/apply/billFinancialEdit.do?currentPage=${currentPage}&id="+id;
		form1.submit();
	}
	function importBill(){
		var searchForm = document.searchForm;
		searchForm.action = "export.do?currentPage=${currentPage}";
		searchForm.submit();
	}
	function sumbit(){
		var searchForm = document.searchForm;
		searchForm.action = "index.do";
		searchForm.submit();
	}
	function openImport(){
		var searchForm = document.searchForm;
		searchForm.action = "openImport.do?currentPage=${currentPage}";
		searchForm.submit();
	}
	function operate(id,n){
		var searchForm = document.searchForm;
		if(n==0)//实收
			searchForm.action = "preIncome.do?currentPage=${currentPage}&id="+id;
		if(n==1)//注销
			searchForm.action = "preCancel.do?currentPage=${currentPage}&id="+id;
		if(n==2)//作废
			searchForm.action = "invalid.do?currentPage=${currentPage}&id="+id;
		if(n==3)//作废重开
			searchForm.action = "preReopen.do?currentPage=${currentPage}&id="+id;
		if(n==4)//注销重开
			searchForm.action = "preCancleReopen.do?currentPage=${currentPage}&id="+id;
		searchForm.submit();
	}
	//发票实收，明细--金融机构
	function editFinancialSelete(id){
		var searchForm = document.searchForm;
		searchForm.action = "<s:property value='contextPath'/>/mf/core/editFinancialSelete.do?currentPage=${currentPage}&id="+id;
		searchForm.submit();
	}
	//修改开票项目说明
	function openUpdateBillRemark(id){
		var searchForm = document.searchForm;
		searchForm.action = "<s:property value='contextPath'/>/mf/core/openUpdateBillRemark.do?currentPage=${currentPage}&id="+id;
		searchForm.submit();
	}
	
</script>
</head>
<body>
<div class="navigation">
  <span>
  <a href="javascript:window.history.forward();"><img src="${contextPath}/images/go_nav_btn.png" /></a>
   <a href="javascript:window.history.forward();">前进</a>
  <a href="javascript:window.location.reload();"><img src="${contextPath}/images/refresh_nav_btn.png" /></a>
   <a href="javascript:window.location.reload();">刷新</a>
  </span>管理费&gt;&gt;发票开立
</div>

<div class="xt_main_right_center">    
<form name="searchForm" id="searchForm" method="post" action="index.do">
	      <table width="100%" border="0" cellpadding="0" cellspacing="0"  style="border-color:#CCCCCC;">
	         <tr>
	           <td class="left-td-width-bg">付款方名称:</td>
	           <td><label>
	             <input type="text" name="billDTO.paymentName" id="textfield" value="${billDTO.paymentName }"  />
               </label></td>
	           <td class="left-td-width-bg">发票号:</td>
	           <td ><label>
	             <input type="text" name="billDTO.billNum" id="textfield2" value="${billDTO.billNum }"  />
               </label></td>
	           <td class="left-td-width-bg">发票名:</td>
	           <td> 
	             <input type="text" name="billDTO.billName" id="textfield3" value="${billDTO.billName }" />
                </td>
            </tr>
	         <tr>
	        	<td class="left-td-width-bg">状态:</td>
	        	<td>
	        	  <s:select name="status" list="@com.jysz.certificate.persistence.enums.mf.IndexBillStatus@values()" theme="simple" listKey="index" listValue="name" headerKey="" headerValue="--请选择--" value="status"></s:select>
       	       </td>
	        	<td class="left-td-width-bg">开票时间:</td>
	        	<td ><input name="openDateBegin"   class="Wdate" type="text" style="width: 100px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="true" value="<s:date name="openDateBegin" format="yyyy-MM-dd"/>"/>
            	至 <input name="openDateEnd"  class="Wdate" type="text" style="width: 100px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="true" value="<s:date name="openDateEnd" format="yyyy-MM-dd"/>"/></td>
	            <td class="left-td-width-bg">申请时间:</td>
	            <td>
	            	<input name="applyDateBegin"   class="Wdate" type="text" style="width: 100px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="true" value="<s:date name="applyDateBegin" format="yyyy-MM-dd"/>"/>
	            	至 <input name="applyDateEnd"  class="Wdate" type="text" style="width: 100px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="true" value="<s:date name="applyDateEnd" format="yyyy-MM-dd"/>"/>
	            </td>
	        </tr>
	         <tr >
	           <td align="left" class="left-td-width-bg" style="border-bottom:none;">经销店</td>
                 <td colspan="3" align="left" style="border-bottom:none;">
                 <jysz:autocompleter name="markShop" cssClass="input_ajax" classType="com.jysz.certificate.persistence.model.system.Shop" displayFields="shopName,shopMark" fieldMapping="{'markShop':'shopName'}">
</jysz:autocompleter>
	        </td>
            <td class="left-td-width-bg">显示零票</td>
                <td><label>
                  <input name="yserNo" value="aaaaa" type="checkbox" id="checkbox" <s:if test="yserNo != null"> checked="checked" </s:if>/>
               </label></td>
            </tr>
            
	         <tr style="background:url(${contextPath}/images/xt_main_right_dhbj.jpg) repeat-x;">
	            <td colspan="6" align="right" style="border-bottom:none;">
	            	 <input type="button" class="btn_clear_form" onclick="clearForm(this.form);return false;"/>
	            	 <input id='sousuo' type="button" value=""onclick="sumbit()"  class="btn_query"/>
	            </td>
	        </tr>
	      </table>
      </form>
</div> 
<br/>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td height="25" align="left"><font color="#0066CC"><strong>发票申请列表：</strong></font></td>
	    <td height="25" align="right">
	    <jysz:permission code="MF_IMPORT_OPEN">
	    <a href="javascript:openImport();">批量开票</a>&nbsp;&nbsp;&nbsp;&nbsp;</jysz:permission>
	    <jysz:permission code="MF_BILL_EXPORT">
	    <a href="javascript:importBill()">导出发票</a></jysz:permission>
	  	</td>
	</tr>
</table> 
      
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
  <tr> 
	    <td class="top-td-width-bg">序号</td>
	    <td class="top-td-width-bg">销售店</td>
	    <td  class="top-td-width-bg">发票号</td>
	    <td class="top-td-width-bg">发票名</td>
	    <td class="top-td-width-bg">付款方名称</td>
	    <td class="top-td-width-bg">应收金额</td>
	    <td class="top-td-width-bg">实收金额</td>
	    <td  class="top-td-width-bg">申请时间</td>
	    <td class="top-td-width-bg">开票日期</td>
	    <td class="top-td-width-bg">状态</td>
	    <td class="top-td-width-bg">开票说明</td>
	    <td class="top-td-width-bg">操作</td>
	</tr>
 	<s:iterator value="page.result" status="st">
		<tr>
			<td class="down-center-td-width-bg">
				<s:property value="#st.index+1"/>
			</td>
			 <s:if test="shop != null ">
			 <td  class="down-center-td-width-bg"><s:property value="shop.shopName" /></td></s:if>
			 <s:else>
			 <td  class="down-center-td-width-bg"></td>
			 </s:else>
	    	<td  class="down-center-td-width-bg"><s:property value="billNum" /></td>
			<td  class="down-center-td-width-bg"><s:property value="billName" /></td>
			<td  class="down-center-td-width-bg"><s:property value="paymentName" /></td>
			<td  class="down-center-td-width-bg"><s:property value="formatAmount(receivableAmount)" /></td>
			<td  class="down-center-td-width-bg"><s:property value="formatAmount(factAmount)" /></td>
			<td  class="down-center-td-width-bg"><s:date name="billApply.applyDate" format="yyyy-MM-dd"/></td>
			<td  class="down-center-td-width-bg"><s:date name="openDate" format="yyyy-MM-dd"/></td>
			<td  class="down-center-td-width-bg"><s:property value="status.name" /></td>
			<td  class="down-center-td-width-bg"><s:property value="billRemark" /></td>
			<td  class="down-center-td-width-bg">
			<jysz:permission code="MF_OPEN">
				 <s:if test="@com.jysz.certificate.persistence.enums.mf.BillStatus@APPLYED.equals(status)">
					<a href="javascript:openBill(<s:property value='id' />);">开立发票</a>
				</s:if>
				</jysz:permission>
				<s:if test="@com.jysz.certificate.persistence.enums.mf.BillStatus@TEMPSAVE.equals(status)">
					<!--  <a href="javascript:openSubmint(<s:property value='id' />);">申请开票</a>-->
					<a href="javascript:billEdit(<s:property value="id"/>)" title="详细"><img src="${contextPath}/images/chakan.gif" alt="详细" width="16" height="13" border="0" /></a>
				</s:if>
				<s:if test="status.index==2">
				<jysz:permission code="MF_BILL_INCOME">
					<a href="javascript:operate(<s:property value='id' />,0);" title="实收">实收</a>
				</jysz:permission>
				<jysz:permission code="MF_BILL_CANCEL">
					<s:if test="getCheckDate(openDate)==1">
					<a href="javascript:operate(<s:property value='id' />,1);" title="注销">注销</a>
					<a href="javascript:operate(<s:property value='id' />,4);" title="注销重开">注销重开</a>
					</s:if>
				</jysz:permission>
				<jysz:permission code="MF_BILL_INVALID">
					<s:if test="getCheckDate(openDate)==0">
					<a href="javascript:operate(<s:property value='id' />,2);" title="作废">作废</a>
					</s:if>
				</jysz:permission>
				<jysz:permission code="MF_BILL_REOPEN">
					<s:if test="getCheckDate(openDate)==0">
					<a href="javascript:operate(<s:property value='id' />,3);" title="作废重开">作废重开</a>
					</s:if>
				</jysz:permission>
				</s:if>
				<s:if test="status.index==3">
				<jysz:permission code="MF_BILL_INCOME">
					<a href="javascript:operate(<s:property value='id' />,0);" title="实收">实收</a>
				</jysz:permission>
				<jysz:permission code="MF_BILL_CANCEL">
					<s:if test="getCheckDate(openDate)==1">
					<a href="javascript:operate(<s:property value='id' />,1);" title="注销">注销</a>
					<a href="javascript:operate(<s:property value='id' />,4);" title="注销重开">注销重开</a>
					</s:if>
				</jysz:permission>
				<jysz:permission code="MF_BILL_REOPEN">
					<s:if test="getCheckDate(openDate)==0">
						<a href="javascript:operate(<s:property value='id' />,3);" title="作废重开">作废重开</a>
					</s:if>
				</jysz:permission>
				</s:if>
				 
				<a href="javascript:editFinancialSelete(<s:property value="id"/>)" title="金融机构详细"><img src="${contextPath}/images/chakan.gif" alt="金融机构详细" width="16" height="13" border="0" /></a>
				<jysz:permission code="MF_BILL_REMARK">
					<s:if test="@com.jysz.certificate.persistence.enums.mf.BillStatus@APPLYED.equals(status)">
						<a href="javascript:openUpdateBillRemark(<s:property value="id"/>)" title="开票说明">修改开票说明</a>
					</s:if>
				</jysz:permission>
			</td>
			
		</tr>
	</s:iterator>
	<tr> 
	 <td colspan="12" class="down-center-td-width-bg" align="right">
			<%@ include file="/WEB-INF/view/common/pagination.jsp"%>
 		</td>
	</tr>
</table>


<br/><br/><br/><br/><br/>
	<div align="center"><jsp:include page="/include/footer.inc"></jsp:include></div>
</body>
</html>